/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>
#include <vector>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    std::vector<int> pos, neg;
    for (int i = 1; i <= n; ++i) {
      int tmp;
      cin >> tmp;
      if (tmp > 0) {
        pos.push_back(tmp);
      }
      if (tmp < 0) {
        neg.push_back(tmp);
      }
    }
    if (pos.size() + neg.size() == 0) {
      cout << "NO\n";
      continue;
    }
    std::vector<int> ans;
    long long sum = 0;
    for (size_t i = 1; i <= n - pos.size() - neg.size(); ++i) {
      ans.push_back(0);
    }
    for (int i = 1; i <= n; ++i) {
      if (sum <= 0 && !pos.empty()) {
        sum += pos.back();
        ans.push_back(pos.back());
        pos.pop_back();
      } else if (sum > 0 && !neg.empty()) {
        sum += neg.back();
        ans.push_back(neg.back());
        neg.pop_back();
      }
    }
    cout << "YES\n";
    for (auto x : ans) {
      cout << x << ' ';
    }
    cout << '\n';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("D. Shocking Arrangement.in", "r", stdin);
  freopen("D. Shocking Arrangement.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
